// 字符串长度 str.length

var str = '123456123abc'
console.log(str.constructor)

// 字符串扩展方法
String.prototype.lgg = function(){
    console.log(this)
}

// 截取,精准index索引截取，从第几位到第几位   3-5
var str1 = str.substring(3, 5)
console.log(str1)

// 截取,固定长度字符串 第三位开始，共5位
var str2 = str.substr(3, 5)
console.log(str2)
console.log(str2.lgg())

// 拆分,
var stra = str.split('5')
console.log(stra)

// 提取,
var strb = str.slice(6)
var strc = str.slice(-3)
console.log(strb)
console.log(strc)


// 连接
var otherStr = ' other'
var trimotherStr = otherStr.trim()
var str3 = str.concat(otherStr)
console.log(str3)

// 替换，匹配正则
var replaceStr = 'www'
var replaceotherStr = str.replace(/12/, replaceStr)
console.log(replaceotherStr)

// 查找，匹配正则  返回第一次找到的位置水索引
var searchStr = 'www'
var searchotherStr = str.search(/23/, searchStr)
console.log(searchotherStr)

// 查找，匹配正则 返回数组
var searchotherStr2 = str.match(/123/)
var searchotherStr3 = str.match(/123/g)
console.log(searchotherStr2)
console.log(searchotherStr3)
